<template>
   <el-table :data="tableData.slice((page-1)*limit,page*limit)" style="width: 100%">
   
    <el-table-column prop="id" label="ID"/>
    <el-table-column prop="ques_name" label="问题"  />
    <el-table-column prop="ques_category" label="分类" />
    <el-table-column prop="ques_detail" label="详情" />
    <el-table-column prop="total_finish" label="提交人次" />
    
  </el-table>

  <el-pagination
      v-model:currentPage="page"
      v-model:page-size="limit"
      :page-sizes="[10, 20, 30, 40]"
      :background="background"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
</template>

<script>
import axios from 'axios'
  export default {
    name:'excel2',
    data(){
      return{
        tableData:[],
        page:1,
        limit:0,
        total:4,
      }
    },
    created(){
      axios.get('http://localhost:8080/excel1/questions').then(
        response => {
          console.log('请求资源成功',response.data)
          this.tableData = [...response.data.data] //拿数据存在二级路径
          // this.total = response.data.data.length
        }
      )

    },
    methods:{
      handleSizeChange(value){
        this.limit = value
      },
      handleCurrentChange(value){
        this.page = value
        this.page = 1
      },

    },

  }
</script>

<style>

</style>